﻿@{
    ViewBag.Title = "ViewPage1";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript" src="/Scripts/Words.js"></script>
<script type="text/javascript" src="/Scripts/ToolBar.js"></script>
<script type="text/javascript">
    function myshow(id, date) {
        document.location = "/GroupShow/indexShow/" + id + "/" + date;
    }
    function mycompanyshow(date) {
        document.location = "/Company/Index/1/" + date;
    }
</script>
<div id="webNav" style="border-top: 1px solid #ccc;">
    <span style="float: left">交易员分析系统 >> 个人首页</span>
</div>
<div id="content">
    <div id="contentLeft">
        <div id="menu">
            @if (string.IsNullOrEmpty(ViewBag.usertype))
            {
                <dl class="itemList_show">
                    <dt>交易员信息</dt>
                    <dd>
                        <div style="text-align: center;">
                            <img src="/Content/images/noavatar_medium.gif" /></div>
                        <div style="text-align: center;">
                            @ViewBag.oper.UName
                        </div>
                        <div style="text-align: left; margin-left: 10%;">
                            所在小组：@ViewBag.groupname</div>
                        <div style="text-align: left; margin-left: 10%;" title="上次登录时间">
                            末次登录：@ViewBag.operatorinfo.LastLoginTime.ToShortDateString()
                        </div>
                        <div style="text-align: left; margin-left: 10%;" title="累计交易天数">
                            交易天数：@ViewBag.operatorinfo.AllTradeDays 天
                        </div>
                        <div style="text-align: left; margin-left: 10%;" title="本周公司排名">
                            公司排名：@ViewBag.mysort
                        </div>
                        <div style="text-align: left; margin-left: 10%;">
                            <table cellspacing="0" cellpadding="0" style="border: 0px;">
                                <tr>
                                    <td style="white-space: nowrap;">
                                        累计收益：
                                    </td>
                                    <td style="white-space: nowrap; overflow: hidden;">
                                        <table cellspacing="0" cellpadding="0" style="border: 0px; width: 100%;">
                                            <tr style="height: 6px; width: 100%;">
                                                <td style="font-size: 6pt; width: 100%;">
                                                    <div style="height: 5px; line-height: 5px; width: @ViewBag.lengths[2]px; border: 1px solid #969696;"
                                                    title="本月盈利 @ViewBag.loginOperatorMonthSum.Profit ，预计最终盈利 @ViewBag.loginOperatorMonthExpected">
                                                        <div style="height: 5px; line-height: 5px; background-color: Red; width: @ViewBag.lengths[0]px;">
                                                        </div>
                                                    </div>
                                                    <div style="width: 100%; height: 1px;">
                                                    </div>
                                                    <div style="height: 5px; line-height: 5px; background-color: blue; width: @ViewBag.lengths[1]px; border: 1px solid #969696;"
                                                    title="上月盈利 @ViewBag.loginOperatorLastMonthSum.Profit">
                                                    </div>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                        </div>
                        <div style="text-align: left; margin-left: 10%;">
                            成长指数：<div style="display: inline-block" title="成长指数：@ViewBag.growthIndex">
                                @for (int i = 0; i < ViewBag.czzsCount; i++)
                                {<img src="/Content/images/grow2.png" />}
                            </div>
                        </div>
                        <div style="text-align: left; margin-left: 10%;">
                            稳定指数：<div style="display: inline-block" title="稳定指数：@ViewBag.stableIndex">
                                @for (int i = 0; i < ViewBag.czzsCount; i++)
                                {<img src="/Content/images/grow.png" />}
                            </div>
                        </div>
                    </dd>
                </dl>
            }
            @{
                BenefitHelper.DB.DBManager db = new BenefitHelper.DB.DBManager();
                List<int> ids = new List<int>();
                string mypdate = ViewBag.TradingDayPdate;
                List<BenefitHelper.Sys.Operator> opers = ViewBag.operators;
                foreach (BenefitHelper.Sys.Groups group in ViewBag.groups)
                {

                    if (BenefitHelper.Sys.VisitPrower.HasGroupPrower(ViewBag.loginuserid, group.Id, db))
                    {
                <dl class="itemList_show">
                    <dt onclick="myshow(@group.Id,@ViewBag.TradingDayPdate)" id="@group.Id">@group.GroupName</dt>
                    @{
                                                                                       var query = new BenefitHelper.Sys.DayGroupOperators().GetGroupOperators(group.Id, Convert.ToDateTime(mypdate.Substring(0, 4) + "-" + mypdate.Substring(4, 2) + "-" + mypdate.Substring(6)), db);
                                                                                       //   var op = from t in opers where t.Id == dgp.OperatorId select t;
                                                                                       //    if (op.Count() > 0)
                                                                                       //    {
                                                                                       //   bool exist=false;
                                                                                       foreach (BenefitHelper.Sys.Operator op in query)
                                                                                       {
                                                                                           ids.Add(op.Id);
                            
                        <dd class="@group.Id">
                            <a href="/OperatorRealtimeTransaction/Index/@op.Id/@ViewBag.TradingDayPdate" >@op.UName</a></dd>
                                                                                       }


                    }
                </dl>
                    }

                }
            }
            @{
    
                bool hasExist = false;
                foreach (BenefitHelper.Sys.Operator op in ViewBag.operators)
                {
                <dl class="itemList_show">
                    @if (!ids.Contains(op.Id))
                    {
                        if (BenefitHelper.Sys.VisitPrower.HasOperatorPrower(ViewBag.loginuserid, op.Id, db))
                        {
                            bool shouldShow = true;
                            foreach (int id in ids)
                            {
                                if (id == op.Id)
                                {
                                    shouldShow = false;
                                    break;
                                }
                            }
                            if (shouldShow)
                            {
                                if (!hasExist)
                                {
                        <dt>其他操作员</dt>
                                }

                                hasExist = true;
                        <dd>
                            <a href="/OperatorRealtimeTransaction/Index/@op.Id/@ViewBag.TradingDayPdate" >@op.UName</a></dd>
                            }
                        }
                    }
                </dl>
                }
            }
            @if (BenefitHelper.Sys.VisitPrower.HasCompanyPrower(ViewBag.loginuserid, db))
            {
                <dl class="itemList_show">
                    <dt onclick="mycompanyshow(@ViewBag.TradingDayPdate)">公司交易信息</dt>
                </dl>
                                          db.Dispose();
            }
        </div>
        <a class="helper" href="http://www.rohon.net/benefithelper" target="_blank">
            <img align="absmiddle" src="/Content/images/help.gif" />使用帮助</a> <a href="mailto:sale@rohon.net"
                class="helper">
                <img src="/Content/images/phone.gif" align="absmiddle" />意见反馈</a>
        <div id="Banner_qingtianzhu">
        </div>
    </div>
    <div id="contentRight">
        @RenderBody()
    </div>
    <div class="clear">
    </div>
</div>
